package site.myvps.querywhois.query;

import java.util.List;

import site.myvps.querywhois.bean.DomainHandleMapper;
import site.myvps.querywhois.bean.QueryResult;
import site.myvps.querywhois.utils.SocketUtil;
import site.myvps.querywhois.utils.StringUtil;

public class GeneralWhoisQuery implements IWhoisQuery {

    @Override
    public QueryResult query(String name, String suffix, DomainHandleMapper mapper) {
        List<String> text = SocketUtil.socketQuery(mapper.getServiceUrl(), mapper.getServicePort(), "" + name + "." + suffix);
        QueryResult result = new QueryResult(0, StringUtil.join("\n", text));
        return result;
    }

}
